<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>Chemicals</title>
<link rel="stylesheet" href="home.css" type="text/css" />
</head>
<body>
<div class="page"><?php include 'menu.php';?>
<div class="content">
<div style="padding: 10px">

<center>
<table style="margin-bottom:20px">
<tr>
<td class="pageTitle">CHEMICALS</td>
</tr>
</table>
</center>

<table class="reconditioned" width="770px">
<tr>
<td class="majHeading" width="30%">NAME</td>
<td class="majHeading" width="48%">INFORMATION</td>
<td class="majHeading" width="22%">DILUTION RATIO</td>
</tr>

<?php
    // Connect to the database server
  $dbcnx = @mysql_connect("localhost", "hydroclean", "winter11");
  if (!$dbcnx) {
    echo( "<P>Unable to connect to the " .
          "database server at this time.</P>" );
    exit();
  }

  // Select the hydroclean database
  if (! @mysql_select_db("hydroclean") ) {
    echo( "<P>Unable to locate the Hydroclean " .
          "database at this time.</P>" );
    exit();
  }
  
  // Request the categories
  $cats = mysql_query(
            "SELECT * FROM chemCategory ORDER BY orderIndex");
  if (!$cats) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }

// Display the column headings
  while ( $catRow = mysql_fetch_array($cats) ) {

    echo("<tr><td colspan='3' class='minHeading'>" . $catRow["categoryText"] . "</td></tr>"); 

    // Request the chemicals for this category
    $chemicals = mysql_query(
	  	"SELECT * FROM chemicals WHERE chemCategoryFK = " . $catRow["chemCategoryIndex"] . " ORDER BY orderIndex ASC");
    if (!$chemicals) {
      echo("<P>Error performing query: " .
           mysql_error() . "</P>");
      exit();
    }
    
   
	// Display each chemical in this category

    $chemCount = 0;
    while ( $chemRow = mysql_fetch_array($chemicals) ) {
		$chemCount++;
		echo("<tr style='clear:both'><td class='caps' style='font-weight:bold'>" . $chemRow["chemTitle"] . "</td>");
		echo("<td>" . $chemRow["chemDesc"] . "</td>");
		echo("<td style='text-align:right'>" . $chemRow["chemDilutionRatio"] . "</td></tr>");
		
		if ($chemCount == 0) 
			echo("<tr><td colspan='4' class='caps'>none available at this time</td></tr>");  
	}
  }
?>




</table>
</center>
</div>
</div>
</body>
</html>
